using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PRICELSTMap : EntityTypeConfiguration<SO_PRICELST>
    {
        public SO_PRICELSTMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.NAME, t.CURRENCY });

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.NAME)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.CURRENCY)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.TYPE)
                .HasMaxLength(9);

            this.Property(t => t.BASIC_PRICE_LIST)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("SO_PRICELST");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.TYPE).HasColumnName("TYPE");
            this.Property(t => t.BASIC_PRICE_LIST).HasColumnName("BASIC_PRICE_LIST");
        }
    }
}
